#!/bin/bash
echo "VimL虚拟机 Debug vs Release 性能对比测试"
echo "=========================================="
echo ""

echo "二进制文件信息:"
echo "  Debug版本大小:   $(ls -lh build/bin/vimlc | awk '{print $5}')"
echo "  Release版本大小: $(ls -lh build_release/bin/vimlc | awk '{print $5}')"
echo ""

echo "递归斐波那契数列性能测试:"
echo "-------------------------"

for n in 10 20 30; do
    echo ""
    echo "=== Fib($n) 性能对比 ==="
    
    # 创建测试文件
    cat > temp_fib_$n.vim << EOF
function Fib(n)
  if n < 2
    return n
  else
    return Fib(n-1) + Fib(n-2)
  endif
endfunction

echo Fib($n)
EOF
    
    echo "Debug版本:"
    time ./build/bin/vimlc temp_fib_$n.vim 2>/dev/null
    
    echo ""
    echo "Release版本:"
    time ./build_release/bin/vimlc temp_fib_$n.vim 2>/dev/null
    
    rm -f temp_fib_$n.vim
done

echo ""
echo "=========================================="
echo "测试完成"